<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/8 0008
 * Time: 上午 10:25
 */

namespace App\Services;



use App\Permission;
use Storage;

class RouteService extends Service
{
    public function getAdminRoutes(){
        if (Storage::exists('web_route.json')){
            return json_decode(Storage::get('web_route.json'), true);
        }
        $route = new Permission();
        $routes = $route->all()->toArray();
        Storage::put('web_route.json', json_encode($routes));
        return $routes;
    }

    /**
     * @description:更新路由
     * @author: hkw <hkw925@qq.com>
     */
    public function updateRouteCache(){
        $route = new Permission();
        $routes = $route->all()->toArray();
        Storage::put('web_route.json', json_encode($routes));
    }
}